Consider the Born-Sommerfeld quantization condition (modified) [see Einstein–Brillouin–Keller (EBK)]
$$I_{i} = \frac{1}{2\pi}S_{i} = \frac{1}{2\pi}\oint p_{i} dq_{i} = \hbar \left(n_{i} + \frac{\mu_{i}}{4} + \frac{b_{i}}{2} \right),\tag{1}$$
when applied to the semi-harmonic oscillator with potential,
$$V(x) = \frac{1}{2}m\omega^{2}x^{2}\text{ for }x>0\text{ and }V(x) = \infty\text{ otherwise.} \tag{2}$$
We here have a turning point at $x=x_{1}$, say $x_{1} = a$ and obtain the expression for this as
$$a = \frac{1}{\omega}\sqrt{\frac{2E}{m}}.\tag{3}$$
We can find that upon integration, $\int_{0}^{a}k(x) dx = \frac{\pi E}{2\hbar \omega}$. Now, in the quantization condition, the Maslov indices take the values $\mu = 1$ and $b = 1$ for the reasons that there is one turning point and since there is one reflection at the hard wall (and also since $\Psi(0) = 0$ holds) respectively. Upon doing this substitution, we get
$$I_{x} = \frac{1}{2\pi}S_{x} = \frac{1}{2\pi}\int p(x) dx = \left(n + \frac{3}{4} \right)\hbar,\tag{4}$$
and this, when equated to what was found previously doesn't give the correct expression for $E_{n}$. This seems to work only when we take $S_{x} = 2\int p(x) dx$, since this correctly gives $E_{n} = \left(2n+\frac{3}{2}\right)\hbar\omega$. How do we account for this factor of "$2$"? Is this to do with phase changes due to the reflections or that we take into consideration both possibilities of solutions with $E<V(x)$ and $E>V(x)$ at the turning point?
Links to other questions about EKB: for an outline of general features: 1, for derivation and additional references: 2, about the Maslov index in Bohr-Sommerfeld quantization condition: 3, for references: 4.